/*************************************************************************
    > File Name: main.c
    > Author: 茉莉玫瑰花茶
    > Mail: 19835250658@163.com
    > Created Time: Sun 06 Jul 2025 09:40:21 PM CST
 ************************************************************************/

#include "process.h"

double total = 1024.0; // 下载总量
double speed = 1.0;    // 下载速度

typedef void (*callback)(double total, double current);

void Download(callback cb)
{
    // 当前下载量
    double current = 0;
    while (current <= total)
    {
        // 显示进度条
        cb(total, current);

        usleep(1000);
        current += speed;
    }
    printf("\ndownload %.2lfMB Done\n", current);
}

int main()
{
    // process_v1();
    Download(FlushProcess);
    return 0;
}
